{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "a872c6c5-9901-42f6-9651-d2c14bfb2ed1",
   "metadata": {},
   "outputs": [],
   "source": [
    "from nba_api.stats.static import teams\n",
    "from nba_api.stats.endpoints import leaguegamefinder\n",
    "from elasticsearch import Elasticsearch, helpers\n",
    "from getpass import getpass"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "d11e91d8-f662-46c9-9daa-7f6a4f111bf7",
   "metadata": {},
   "outputs": [],
   "source": [
    "nba_teams = teams.get_teams()\n",
    "celtics = [team for team in nba_teams if team[\"abbreviation\"] == \"BOS\"][0]\n",
    "celtics_id = celtics[\"id\"]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "c6132d82-914d-449f-80c2-5788c9dba54e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>SEASON_ID</th>\n",
       "      <th>TEAM_ID</th>\n",
       "      <th>TEAM_ABBREVIATION</th>\n",
       "      <th>TEAM_NAME</th>\n",
       "      <th>GAME_ID</th>\n",
       "      <th>GAME_DATE</th>\n",
       "      <th>MATCHUP</th>\n",
       "      <th>WL</th>\n",
       "      <th>MIN</th>\n",
       "      <th>PTS</th>\n",
       "      <th>...</th>\n",
       "      <th>FT_PCT</th>\n",
       "      <th>OREB</th>\n",
       "      <th>DREB</th>\n",
       "      <th>REB</th>\n",
       "      <th>AST</th>\n",
       "      <th>STL</th>\n",
       "      <th>BLK</th>\n",
       "      <th>TOV</th>\n",
       "      <th>PF</th>\n",
       "      <th>PLUS_MINUS</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>22023</td>\n",
       "      <td>1610612738</td>\n",
       "      <td>BOS</td>\n",
       "      <td>Boston Celtics</td>\n",
       "      <td>0022300528</td>\n",
       "      <td>2024-01-11</td>\n",
       "      <td>BOS @ MIL</td>\n",
       "      <td>L</td>\n",
       "      <td>241</td>\n",
       "      <td>102</td>\n",
       "      <td>...</td>\n",
       "      <td>0.833</td>\n",
       "      <td>6</td>\n",
       "      <td>25</td>\n",
       "      <td>31</td>\n",
       "      <td>22</td>\n",
       "      <td>5</td>\n",
       "      <td>5</td>\n",
       "      <td>6</td>\n",
       "      <td>13</td>\n",
       "      <td>-33.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>22023</td>\n",
       "      <td>1610612738</td>\n",
       "      <td>BOS</td>\n",
       "      <td>Boston Celtics</td>\n",
       "      <td>0022300517</td>\n",
       "      <td>2024-01-10</td>\n",
       "      <td>BOS vs. MIN</td>\n",
       "      <td>W</td>\n",
       "      <td>263</td>\n",
       "      <td>127</td>\n",
       "      <td>...</td>\n",
       "      <td>0.968</td>\n",
       "      <td>7</td>\n",
       "      <td>39</td>\n",
       "      <td>46</td>\n",
       "      <td>21</td>\n",
       "      <td>5</td>\n",
       "      <td>4</td>\n",
       "      <td>8</td>\n",
       "      <td>19</td>\n",
       "      <td>7.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>22023</td>\n",
       "      <td>1610612738</td>\n",
       "      <td>BOS</td>\n",
       "      <td>Boston Celtics</td>\n",
       "      <td>0022300507</td>\n",
       "      <td>2024-01-08</td>\n",
       "      <td>BOS @ IND</td>\n",
       "      <td>L</td>\n",
       "      <td>240</td>\n",
       "      <td>131</td>\n",
       "      <td>...</td>\n",
       "      <td>0.690</td>\n",
       "      <td>13</td>\n",
       "      <td>29</td>\n",
       "      <td>42</td>\n",
       "      <td>26</td>\n",
       "      <td>3</td>\n",
       "      <td>8</td>\n",
       "      <td>15</td>\n",
       "      <td>20</td>\n",
       "      <td>-2.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>22023</td>\n",
       "      <td>1610612738</td>\n",
       "      <td>BOS</td>\n",
       "      <td>Boston Celtics</td>\n",
       "      <td>0022300493</td>\n",
       "      <td>2024-01-06</td>\n",
       "      <td>BOS @ IND</td>\n",
       "      <td>W</td>\n",
       "      <td>240</td>\n",
       "      <td>118</td>\n",
       "      <td>...</td>\n",
       "      <td>0.526</td>\n",
       "      <td>13</td>\n",
       "      <td>43</td>\n",
       "      <td>56</td>\n",
       "      <td>26</td>\n",
       "      <td>6</td>\n",
       "      <td>6</td>\n",
       "      <td>17</td>\n",
       "      <td>20</td>\n",
       "      <td>17.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>22023</td>\n",
       "      <td>1610612738</td>\n",
       "      <td>BOS</td>\n",
       "      <td>Boston Celtics</td>\n",
       "      <td>0022300479</td>\n",
       "      <td>2024-01-05</td>\n",
       "      <td>BOS vs. UTA</td>\n",
       "      <td>W</td>\n",
       "      <td>240</td>\n",
       "      <td>126</td>\n",
       "      <td>...</td>\n",
       "      <td>0.861</td>\n",
       "      <td>9</td>\n",
       "      <td>47</td>\n",
       "      <td>56</td>\n",
       "      <td>24</td>\n",
       "      <td>9</td>\n",
       "      <td>8</td>\n",
       "      <td>12</td>\n",
       "      <td>23</td>\n",
       "      <td>29.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 28 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "  SEASON_ID     TEAM_ID TEAM_ABBREVIATION       TEAM_NAME     GAME_ID  \\\n",
       "0     22023  1610612738               BOS  Boston Celtics  0022300528   \n",
       "1     22023  1610612738               BOS  Boston Celtics  0022300517   \n",
       "2     22023  1610612738               BOS  Boston Celtics  0022300507   \n",
       "3     22023  1610612738               BOS  Boston Celtics  0022300493   \n",
       "4     22023  1610612738               BOS  Boston Celtics  0022300479   \n",
       "\n",
       "    GAME_DATE      MATCHUP WL  MIN  PTS  ...  FT_PCT  OREB  DREB  REB  AST  \\\n",
       "0  2024-01-11    BOS @ MIL  L  241  102  ...   0.833     6    25   31   22   \n",
       "1  2024-01-10  BOS vs. MIN  W  263  127  ...   0.968     7    39   46   21   \n",
       "2  2024-01-08    BOS @ IND  L  240  131  ...   0.690    13    29   42   26   \n",
       "3  2024-01-06    BOS @ IND  W  240  118  ...   0.526    13    43   56   26   \n",
       "4  2024-01-05  BOS vs. UTA  W  240  126  ...   0.861     9    47   56   24   \n",
       "\n",
       "   STL  BLK  TOV  PF  PLUS_MINUS  \n",
       "0    5    5    6  13       -33.0  \n",
       "1    5    4    8  19         7.0  \n",
       "2    3    8   15  20        -2.0  \n",
       "3    6    6   17  20        17.0  \n",
       "4    9    8   12  23        29.0  \n",
       "\n",
       "[5 rows x 28 columns]"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "gamefinder = leaguegamefinder.LeagueGameFinder(team_id_nullable=celtics_id)\n",
    "games = gamefinder.get_data_frames()[0]\n",
    "games.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "774aacde-f6a8-42bd-9925-53d346a108e7",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>SEASON_ID</th>\n",
       "      <th>TEAM_ID</th>\n",
       "      <th>TEAM_ABBREVIATION</th>\n",
       "      <th>TEAM_NAME</th>\n",
       "      <th>GAME_ID</th>\n",
       "      <th>GAME_DATE</th>\n",
       "      <th>MATCHUP</th>\n",
       "      <th>WL</th>\n",
       "      <th>MIN</th>\n",
       "      <th>PTS</th>\n",
       "      <th>...</th>\n",
       "      <th>FT_PCT</th>\n",
       "      <th>OREB</th>\n",
       "      <th>DREB</th>\n",
       "      <th>REB</th>\n",
       "      <th>AST</th>\n",
       "      <th>STL</th>\n",
       "      <th>BLK</th>\n",
       "      <th>TOV</th>\n",
       "      <th>PF</th>\n",
       "      <th>PLUS_MINUS</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>22023</td>\n",
       "      <td>1610612738</td>\n",
       "      <td>BOS</td>\n",
       "      <td>Boston Celtics</td>\n",
       "      <td>0022300528</td>\n",
       "      <td>2024-01-11</td>\n",
       "      <td>BOS @ MIL</td>\n",
       "      <td>L</td>\n",
       "      <td>241</td>\n",
       "      <td>102</td>\n",
       "      <td>...</td>\n",
       "      <td>0.833</td>\n",
       "      <td>6</td>\n",
       "      <td>25</td>\n",
       "      <td>31</td>\n",
       "      <td>22</td>\n",
       "      <td>5</td>\n",
       "      <td>5</td>\n",
       "      <td>6</td>\n",
       "      <td>13</td>\n",
       "      <td>-33.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>22023</td>\n",
       "      <td>1610612738</td>\n",
       "      <td>BOS</td>\n",
       "      <td>Boston Celtics</td>\n",
       "      <td>0022300517</td>\n",
       "      <td>2024-01-10</td>\n",
       "      <td>BOS vs. MIN</td>\n",
       "      <td>W</td>\n",
       "      <td>263</td>\n",
       "      <td>127</td>\n",
       "      <td>...</td>\n",
       "      <td>0.968</td>\n",
       "      <td>7</td>\n",
       "      <td>39</td>\n",
       "      <td>46</td>\n",
       "      <td>21</td>\n",
       "      <td>5</td>\n",
       "      <td>4</td>\n",
       "      <td>8</td>\n",
       "      <td>19</td>\n",
       "      <td>7.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>22023</td>\n",
       "      <td>1610612738</td>\n",
       "      <td>BOS</td>\n",
       "      <td>Boston Celtics</td>\n",
       "      <td>0022300507</td>\n",
       "      <td>2024-01-08</td>\n",
       "      <td>BOS @ IND</td>\n",
       "      <td>L</td>\n",
       "      <td>240</td>\n",
       "      <td>131</td>\n",
       "      <td>...</td>\n",
       "      <td>0.690</td>\n",
       "      <td>13</td>\n",
       "      <td>29</td>\n",
       "      <td>42</td>\n",
       "      <td>26</td>\n",
       "      <td>3</td>\n",
       "      <td>8</td>\n",
       "      <td>15</td>\n",
       "      <td>20</td>\n",
       "      <td>-2.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>22023</td>\n",
       "      <td>1610612738</td>\n",
       "      <td>BOS</td>\n",
       "      <td>Boston Celtics</td>\n",
       "      <td>0022300493</td>\n",
       "      <td>2024-01-06</td>\n",
       "      <td>BOS @ IND</td>\n",
       "      <td>W</td>\n",
       "      <td>240</td>\n",
       "      <td>118</td>\n",
       "      <td>...</td>\n",
       "      <td>0.526</td>\n",
       "      <td>13</td>\n",
       "      <td>43</td>\n",
       "      <td>56</td>\n",
       "      <td>26</td>\n",
       "      <td>6</td>\n",
       "      <td>6</td>\n",
       "      <td>17</td>\n",
       "      <td>20</td>\n",
       "      <td>17.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>22023</td>\n",
       "      <td>1610612738</td>\n",
       "      <td>BOS</td>\n",
       "      <td>Boston Celtics</td>\n",
       "      <td>0022300479</td>\n",
       "      <td>2024-01-05</td>\n",
       "      <td>BOS vs. UTA</td>\n",
       "      <td>W</td>\n",
       "      <td>240</td>\n",
       "      <td>126</td>\n",
       "      <td>...</td>\n",
       "      <td>0.861</td>\n",
       "      <td>9</td>\n",
       "      <td>47</td>\n",
       "      <td>56</td>\n",
       "      <td>24</td>\n",
       "      <td>9</td>\n",
       "      <td>8</td>\n",
       "      <td>12</td>\n",
       "      <td>23</td>\n",
       "      <td>29.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>22023</td>\n",
       "      <td>1610612738</td>\n",
       "      <td>BOS</td>\n",
       "      <td>Boston Celtics</td>\n",
       "      <td>0022300462</td>\n",
       "      <td>2024-01-02</td>\n",
       "      <td>BOS @ OKC</td>\n",
       "      <td>L</td>\n",
       "      <td>241</td>\n",
       "      <td>123</td>\n",
       "      <td>...</td>\n",
       "      <td>0.828</td>\n",
       "      <td>17</td>\n",
       "      <td>30</td>\n",
       "      <td>47</td>\n",
       "      <td>33</td>\n",
       "      <td>7</td>\n",
       "      <td>10</td>\n",
       "      <td>14</td>\n",
       "      <td>15</td>\n",
       "      <td>-4.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>22023</td>\n",
       "      <td>1610612738</td>\n",
       "      <td>BOS</td>\n",
       "      <td>Boston Celtics</td>\n",
       "      <td>0022300448</td>\n",
       "      <td>2023-12-31</td>\n",
       "      <td>BOS @ SAS</td>\n",
       "      <td>W</td>\n",
       "      <td>240</td>\n",
       "      <td>134</td>\n",
       "      <td>...</td>\n",
       "      <td>0.773</td>\n",
       "      <td>13</td>\n",
       "      <td>44</td>\n",
       "      <td>57</td>\n",
       "      <td>29</td>\n",
       "      <td>6</td>\n",
       "      <td>7</td>\n",
       "      <td>10</td>\n",
       "      <td>12</td>\n",
       "      <td>33.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>22023</td>\n",
       "      <td>1610612738</td>\n",
       "      <td>BOS</td>\n",
       "      <td>Boston Celtics</td>\n",
       "      <td>0022300432</td>\n",
       "      <td>2023-12-29</td>\n",
       "      <td>BOS vs. TOR</td>\n",
       "      <td>W</td>\n",
       "      <td>239</td>\n",
       "      <td>120</td>\n",
       "      <td>...</td>\n",
       "      <td>0.850</td>\n",
       "      <td>13</td>\n",
       "      <td>39</td>\n",
       "      <td>52</td>\n",
       "      <td>29</td>\n",
       "      <td>3</td>\n",
       "      <td>6</td>\n",
       "      <td>16</td>\n",
       "      <td>17</td>\n",
       "      <td>2.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>22023</td>\n",
       "      <td>1610612738</td>\n",
       "      <td>BOS</td>\n",
       "      <td>Boston Celtics</td>\n",
       "      <td>0022300421</td>\n",
       "      <td>2023-12-28</td>\n",
       "      <td>BOS vs. DET</td>\n",
       "      <td>W</td>\n",
       "      <td>266</td>\n",
       "      <td>128</td>\n",
       "      <td>...</td>\n",
       "      <td>0.840</td>\n",
       "      <td>11</td>\n",
       "      <td>32</td>\n",
       "      <td>43</td>\n",
       "      <td>25</td>\n",
       "      <td>10</td>\n",
       "      <td>4</td>\n",
       "      <td>12</td>\n",
       "      <td>15</td>\n",
       "      <td>6.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>22023</td>\n",
       "      <td>1610612738</td>\n",
       "      <td>BOS</td>\n",
       "      <td>Boston Celtics</td>\n",
       "      <td>0022300403</td>\n",
       "      <td>2023-12-25</td>\n",
       "      <td>BOS @ LAL</td>\n",
       "      <td>W</td>\n",
       "      <td>240</td>\n",
       "      <td>126</td>\n",
       "      <td>...</td>\n",
       "      <td>0.750</td>\n",
       "      <td>11</td>\n",
       "      <td>33</td>\n",
       "      <td>44</td>\n",
       "      <td>31</td>\n",
       "      <td>8</td>\n",
       "      <td>7</td>\n",
       "      <td>8</td>\n",
       "      <td>17</td>\n",
       "      <td>11.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>22023</td>\n",
       "      <td>1610612738</td>\n",
       "      <td>BOS</td>\n",
       "      <td>Boston Celtics</td>\n",
       "      <td>0022300389</td>\n",
       "      <td>2023-12-23</td>\n",
       "      <td>BOS @ LAC</td>\n",
       "      <td>W</td>\n",
       "      <td>241</td>\n",
       "      <td>145</td>\n",
       "      <td>...</td>\n",
       "      <td>0.786</td>\n",
       "      <td>15</td>\n",
       "      <td>36</td>\n",
       "      <td>51</td>\n",
       "      <td>33</td>\n",
       "      <td>4</td>\n",
       "      <td>5</td>\n",
       "      <td>9</td>\n",
       "      <td>19</td>\n",
       "      <td>37.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>22023</td>\n",
       "      <td>1610612738</td>\n",
       "      <td>BOS</td>\n",
       "      <td>Boston Celtics</td>\n",
       "      <td>0022300373</td>\n",
       "      <td>2023-12-20</td>\n",
       "      <td>BOS @ SAC</td>\n",
       "      <td>W</td>\n",
       "      <td>239</td>\n",
       "      <td>144</td>\n",
       "      <td>...</td>\n",
       "      <td>0.833</td>\n",
       "      <td>14</td>\n",
       "      <td>36</td>\n",
       "      <td>50</td>\n",
       "      <td>35</td>\n",
       "      <td>6</td>\n",
       "      <td>10</td>\n",
       "      <td>9</td>\n",
       "      <td>17</td>\n",
       "      <td>25.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>22023</td>\n",
       "      <td>1610612738</td>\n",
       "      <td>BOS</td>\n",
       "      <td>Boston Celtics</td>\n",
       "      <td>0022300362</td>\n",
       "      <td>2023-12-19</td>\n",
       "      <td>BOS @ GSW</td>\n",
       "      <td>L</td>\n",
       "      <td>264</td>\n",
       "      <td>126</td>\n",
       "      <td>...</td>\n",
       "      <td>0.882</td>\n",
       "      <td>18</td>\n",
       "      <td>37</td>\n",
       "      <td>55</td>\n",
       "      <td>28</td>\n",
       "      <td>6</td>\n",
       "      <td>5</td>\n",
       "      <td>8</td>\n",
       "      <td>13</td>\n",
       "      <td>-6.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>22023</td>\n",
       "      <td>1610612738</td>\n",
       "      <td>BOS</td>\n",
       "      <td>Boston Celtics</td>\n",
       "      <td>0022300344</td>\n",
       "      <td>2023-12-17</td>\n",
       "      <td>BOS vs. ORL</td>\n",
       "      <td>W</td>\n",
       "      <td>239</td>\n",
       "      <td>114</td>\n",
       "      <td>...</td>\n",
       "      <td>0.875</td>\n",
       "      <td>10</td>\n",
       "      <td>45</td>\n",
       "      <td>55</td>\n",
       "      <td>18</td>\n",
       "      <td>4</td>\n",
       "      <td>10</td>\n",
       "      <td>14</td>\n",
       "      <td>19</td>\n",
       "      <td>17.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>22023</td>\n",
       "      <td>1610612738</td>\n",
       "      <td>BOS</td>\n",
       "      <td>Boston Celtics</td>\n",
       "      <td>0022300329</td>\n",
       "      <td>2023-12-15</td>\n",
       "      <td>BOS vs. ORL</td>\n",
       "      <td>W</td>\n",
       "      <td>240</td>\n",
       "      <td>128</td>\n",
       "      <td>...</td>\n",
       "      <td>0.700</td>\n",
       "      <td>9</td>\n",
       "      <td>25</td>\n",
       "      <td>34</td>\n",
       "      <td>31</td>\n",
       "      <td>14</td>\n",
       "      <td>7</td>\n",
       "      <td>10</td>\n",
       "      <td>22</td>\n",
       "      <td>17.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>22023</td>\n",
       "      <td>1610612738</td>\n",
       "      <td>BOS</td>\n",
       "      <td>Boston Celtics</td>\n",
       "      <td>0022300319</td>\n",
       "      <td>2023-12-14</td>\n",
       "      <td>BOS vs. CLE</td>\n",
       "      <td>W</td>\n",
       "      <td>240</td>\n",
       "      <td>116</td>\n",
       "      <td>...</td>\n",
       "      <td>0.850</td>\n",
       "      <td>13</td>\n",
       "      <td>31</td>\n",
       "      <td>44</td>\n",
       "      <td>22</td>\n",
       "      <td>7</td>\n",
       "      <td>8</td>\n",
       "      <td>13</td>\n",
       "      <td>15</td>\n",
       "      <td>9.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>22023</td>\n",
       "      <td>1610612738</td>\n",
       "      <td>BOS</td>\n",
       "      <td>Boston Celtics</td>\n",
       "      <td>0022300305</td>\n",
       "      <td>2023-12-12</td>\n",
       "      <td>BOS vs. CLE</td>\n",
       "      <td>W</td>\n",
       "      <td>241</td>\n",
       "      <td>120</td>\n",
       "      <td>...</td>\n",
       "      <td>1.000</td>\n",
       "      <td>12</td>\n",
       "      <td>33</td>\n",
       "      <td>45</td>\n",
       "      <td>23</td>\n",
       "      <td>9</td>\n",
       "      <td>9</td>\n",
       "      <td>13</td>\n",
       "      <td>13</td>\n",
       "      <td>7.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>22023</td>\n",
       "      <td>1610612738</td>\n",
       "      <td>BOS</td>\n",
       "      <td>Boston Celtics</td>\n",
       "      <td>0022301227</td>\n",
       "      <td>2023-12-08</td>\n",
       "      <td>BOS vs. NYK</td>\n",
       "      <td>W</td>\n",
       "      <td>240</td>\n",
       "      <td>133</td>\n",
       "      <td>...</td>\n",
       "      <td>0.857</td>\n",
       "      <td>8</td>\n",
       "      <td>26</td>\n",
       "      <td>34</td>\n",
       "      <td>24</td>\n",
       "      <td>8</td>\n",
       "      <td>5</td>\n",
       "      <td>7</td>\n",
       "      <td>19</td>\n",
       "      <td>10.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>22023</td>\n",
       "      <td>1610612738</td>\n",
       "      <td>BOS</td>\n",
       "      <td>Boston Celtics</td>\n",
       "      <td>0022301202</td>\n",
       "      <td>2023-12-04</td>\n",
       "      <td>BOS @ IND</td>\n",
       "      <td>L</td>\n",
       "      <td>239</td>\n",
       "      <td>112</td>\n",
       "      <td>...</td>\n",
       "      <td>0.667</td>\n",
       "      <td>13</td>\n",
       "      <td>43</td>\n",
       "      <td>56</td>\n",
       "      <td>27</td>\n",
       "      <td>5</td>\n",
       "      <td>9</td>\n",
       "      <td>17</td>\n",
       "      <td>19</td>\n",
       "      <td>-10.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>22023</td>\n",
       "      <td>1610612738</td>\n",
       "      <td>BOS</td>\n",
       "      <td>Boston Celtics</td>\n",
       "      <td>0022300275</td>\n",
       "      <td>2023-12-01</td>\n",
       "      <td>BOS vs. PHI</td>\n",
       "      <td>W</td>\n",
       "      <td>239</td>\n",
       "      <td>125</td>\n",
       "      <td>...</td>\n",
       "      <td>0.861</td>\n",
       "      <td>10</td>\n",
       "      <td>36</td>\n",
       "      <td>46</td>\n",
       "      <td>25</td>\n",
       "      <td>10</td>\n",
       "      <td>8</td>\n",
       "      <td>20</td>\n",
       "      <td>18</td>\n",
       "      <td>6.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>22023</td>\n",
       "      <td>1610612738</td>\n",
       "      <td>BOS</td>\n",
       "      <td>Boston Celtics</td>\n",
       "      <td>0022300053</td>\n",
       "      <td>2023-11-28</td>\n",
       "      <td>BOS vs. CHI</td>\n",
       "      <td>W</td>\n",
       "      <td>241</td>\n",
       "      <td>124</td>\n",
       "      <td>...</td>\n",
       "      <td>0.750</td>\n",
       "      <td>11</td>\n",
       "      <td>41</td>\n",
       "      <td>52</td>\n",
       "      <td>36</td>\n",
       "      <td>6</td>\n",
       "      <td>9</td>\n",
       "      <td>16</td>\n",
       "      <td>18</td>\n",
       "      <td>27.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>22023</td>\n",
       "      <td>1610612738</td>\n",
       "      <td>BOS</td>\n",
       "      <td>Boston Celtics</td>\n",
       "      <td>0022300246</td>\n",
       "      <td>2023-11-26</td>\n",
       "      <td>BOS vs. ATL</td>\n",
       "      <td>W</td>\n",
       "      <td>239</td>\n",
       "      <td>113</td>\n",
       "      <td>...</td>\n",
       "      <td>0.800</td>\n",
       "      <td>18</td>\n",
       "      <td>40</td>\n",
       "      <td>58</td>\n",
       "      <td>24</td>\n",
       "      <td>9</td>\n",
       "      <td>3</td>\n",
       "      <td>12</td>\n",
       "      <td>19</td>\n",
       "      <td>10.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>22023</td>\n",
       "      <td>1610612738</td>\n",
       "      <td>BOS</td>\n",
       "      <td>Boston Celtics</td>\n",
       "      <td>0022300043</td>\n",
       "      <td>2023-11-24</td>\n",
       "      <td>BOS @ ORL</td>\n",
       "      <td>L</td>\n",
       "      <td>240</td>\n",
       "      <td>96</td>\n",
       "      <td>...</td>\n",
       "      <td>0.730</td>\n",
       "      <td>4</td>\n",
       "      <td>27</td>\n",
       "      <td>31</td>\n",
       "      <td>17</td>\n",
       "      <td>10</td>\n",
       "      <td>4</td>\n",
       "      <td>14</td>\n",
       "      <td>18</td>\n",
       "      <td>-17.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>22023</td>\n",
       "      <td>1610612738</td>\n",
       "      <td>BOS</td>\n",
       "      <td>Boston Celtics</td>\n",
       "      <td>0022300228</td>\n",
       "      <td>2023-11-22</td>\n",
       "      <td>BOS vs. MIL</td>\n",
       "      <td>W</td>\n",
       "      <td>240</td>\n",
       "      <td>119</td>\n",
       "      <td>...</td>\n",
       "      <td>0.824</td>\n",
       "      <td>4</td>\n",
       "      <td>39</td>\n",
       "      <td>43</td>\n",
       "      <td>27</td>\n",
       "      <td>3</td>\n",
       "      <td>5</td>\n",
       "      <td>15</td>\n",
       "      <td>15</td>\n",
       "      <td>3.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>22023</td>\n",
       "      <td>1610612738</td>\n",
       "      <td>BOS</td>\n",
       "      <td>Boston Celtics</td>\n",
       "      <td>0022300217</td>\n",
       "      <td>2023-11-20</td>\n",
       "      <td>BOS @ CHA</td>\n",
       "      <td>L</td>\n",
       "      <td>264</td>\n",
       "      <td>118</td>\n",
       "      <td>...</td>\n",
       "      <td>0.643</td>\n",
       "      <td>11</td>\n",
       "      <td>37</td>\n",
       "      <td>48</td>\n",
       "      <td>19</td>\n",
       "      <td>6</td>\n",
       "      <td>8</td>\n",
       "      <td>13</td>\n",
       "      <td>15</td>\n",
       "      <td>-3.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>22023</td>\n",
       "      <td>1610612738</td>\n",
       "      <td>BOS</td>\n",
       "      <td>Boston Celtics</td>\n",
       "      <td>0022300213</td>\n",
       "      <td>2023-11-19</td>\n",
       "      <td>BOS @ MEM</td>\n",
       "      <td>W</td>\n",
       "      <td>241</td>\n",
       "      <td>102</td>\n",
       "      <td>...</td>\n",
       "      <td>0.800</td>\n",
       "      <td>9</td>\n",
       "      <td>36</td>\n",
       "      <td>45</td>\n",
       "      <td>20</td>\n",
       "      <td>6</td>\n",
       "      <td>10</td>\n",
       "      <td>17</td>\n",
       "      <td>19</td>\n",
       "      <td>2.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>22023</td>\n",
       "      <td>1610612738</td>\n",
       "      <td>BOS</td>\n",
       "      <td>Boston Celtics</td>\n",
       "      <td>0022300031</td>\n",
       "      <td>2023-11-17</td>\n",
       "      <td>BOS @ TOR</td>\n",
       "      <td>W</td>\n",
       "      <td>240</td>\n",
       "      <td>108</td>\n",
       "      <td>...</td>\n",
       "      <td>0.889</td>\n",
       "      <td>8</td>\n",
       "      <td>36</td>\n",
       "      <td>44</td>\n",
       "      <td>29</td>\n",
       "      <td>5</td>\n",
       "      <td>4</td>\n",
       "      <td>10</td>\n",
       "      <td>13</td>\n",
       "      <td>3.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>22023</td>\n",
       "      <td>1610612738</td>\n",
       "      <td>BOS</td>\n",
       "      <td>Boston Celtics</td>\n",
       "      <td>0022300194</td>\n",
       "      <td>2023-11-15</td>\n",
       "      <td>BOS @ PHI</td>\n",
       "      <td>W</td>\n",
       "      <td>239</td>\n",
       "      <td>117</td>\n",
       "      <td>...</td>\n",
       "      <td>0.789</td>\n",
       "      <td>12</td>\n",
       "      <td>33</td>\n",
       "      <td>45</td>\n",
       "      <td>23</td>\n",
       "      <td>7</td>\n",
       "      <td>8</td>\n",
       "      <td>9</td>\n",
       "      <td>15</td>\n",
       "      <td>10.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>22023</td>\n",
       "      <td>1610612738</td>\n",
       "      <td>BOS</td>\n",
       "      <td>Boston Celtics</td>\n",
       "      <td>0022300188</td>\n",
       "      <td>2023-11-13</td>\n",
       "      <td>BOS vs. NYK</td>\n",
       "      <td>W</td>\n",
       "      <td>238</td>\n",
       "      <td>114</td>\n",
       "      <td>...</td>\n",
       "      <td>0.938</td>\n",
       "      <td>8</td>\n",
       "      <td>29</td>\n",
       "      <td>37</td>\n",
       "      <td>27</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>11</td>\n",
       "      <td>22</td>\n",
       "      <td>16.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>22023</td>\n",
       "      <td>1610612738</td>\n",
       "      <td>BOS</td>\n",
       "      <td>Boston Celtics</td>\n",
       "      <td>0022300174</td>\n",
       "      <td>2023-11-11</td>\n",
       "      <td>BOS vs. TOR</td>\n",
       "      <td>W</td>\n",
       "      <td>242</td>\n",
       "      <td>117</td>\n",
       "      <td>...</td>\n",
       "      <td>0.615</td>\n",
       "      <td>5</td>\n",
       "      <td>41</td>\n",
       "      <td>46</td>\n",
       "      <td>30</td>\n",
       "      <td>1</td>\n",
       "      <td>4</td>\n",
       "      <td>12</td>\n",
       "      <td>14</td>\n",
       "      <td>23.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>22023</td>\n",
       "      <td>1610612738</td>\n",
       "      <td>BOS</td>\n",
       "      <td>Boston Celtics</td>\n",
       "      <td>0022300010</td>\n",
       "      <td>2023-11-10</td>\n",
       "      <td>BOS vs. BKN</td>\n",
       "      <td>W</td>\n",
       "      <td>241</td>\n",
       "      <td>121</td>\n",
       "      <td>...</td>\n",
       "      <td>0.714</td>\n",
       "      <td>17</td>\n",
       "      <td>35</td>\n",
       "      <td>52</td>\n",
       "      <td>29</td>\n",
       "      <td>5</td>\n",
       "      <td>3</td>\n",
       "      <td>7</td>\n",
       "      <td>13</td>\n",
       "      <td>14.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>31</th>\n",
       "      <td>22023</td>\n",
       "      <td>1610612738</td>\n",
       "      <td>BOS</td>\n",
       "      <td>Boston Celtics</td>\n",
       "      <td>0022300159</td>\n",
       "      <td>2023-11-08</td>\n",
       "      <td>BOS @ PHI</td>\n",
       "      <td>L</td>\n",
       "      <td>241</td>\n",
       "      <td>103</td>\n",
       "      <td>...</td>\n",
       "      <td>0.842</td>\n",
       "      <td>9</td>\n",
       "      <td>34</td>\n",
       "      <td>43</td>\n",
       "      <td>28</td>\n",
       "      <td>8</td>\n",
       "      <td>6</td>\n",
       "      <td>12</td>\n",
       "      <td>13</td>\n",
       "      <td>-3.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32</th>\n",
       "      <td>22023</td>\n",
       "      <td>1610612738</td>\n",
       "      <td>BOS</td>\n",
       "      <td>Boston Celtics</td>\n",
       "      <td>0022300154</td>\n",
       "      <td>2023-11-06</td>\n",
       "      <td>BOS @ MIN</td>\n",
       "      <td>L</td>\n",
       "      <td>265</td>\n",
       "      <td>109</td>\n",
       "      <td>...</td>\n",
       "      <td>0.765</td>\n",
       "      <td>11</td>\n",
       "      <td>34</td>\n",
       "      <td>45</td>\n",
       "      <td>20</td>\n",
       "      <td>13</td>\n",
       "      <td>2</td>\n",
       "      <td>16</td>\n",
       "      <td>26</td>\n",
       "      <td>-5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>33</th>\n",
       "      <td>22023</td>\n",
       "      <td>1610612738</td>\n",
       "      <td>BOS</td>\n",
       "      <td>Boston Celtics</td>\n",
       "      <td>0022300136</td>\n",
       "      <td>2023-11-04</td>\n",
       "      <td>BOS @ BKN</td>\n",
       "      <td>W</td>\n",
       "      <td>240</td>\n",
       "      <td>124</td>\n",
       "      <td>...</td>\n",
       "      <td>0.852</td>\n",
       "      <td>10</td>\n",
       "      <td>40</td>\n",
       "      <td>50</td>\n",
       "      <td>22</td>\n",
       "      <td>4</td>\n",
       "      <td>6</td>\n",
       "      <td>11</td>\n",
       "      <td>17</td>\n",
       "      <td>10.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>34</th>\n",
       "      <td>22023</td>\n",
       "      <td>1610612738</td>\n",
       "      <td>BOS</td>\n",
       "      <td>Boston Celtics</td>\n",
       "      <td>0022300118</td>\n",
       "      <td>2023-11-01</td>\n",
       "      <td>BOS vs. IND</td>\n",
       "      <td>W</td>\n",
       "      <td>239</td>\n",
       "      <td>155</td>\n",
       "      <td>...</td>\n",
       "      <td>0.964</td>\n",
       "      <td>11</td>\n",
       "      <td>46</td>\n",
       "      <td>57</td>\n",
       "      <td>27</td>\n",
       "      <td>5</td>\n",
       "      <td>2</td>\n",
       "      <td>11</td>\n",
       "      <td>19</td>\n",
       "      <td>51.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>35</th>\n",
       "      <td>22023</td>\n",
       "      <td>1610612738</td>\n",
       "      <td>BOS</td>\n",
       "      <td>Boston Celtics</td>\n",
       "      <td>0022300103</td>\n",
       "      <td>2023-10-30</td>\n",
       "      <td>BOS @ WAS</td>\n",
       "      <td>W</td>\n",
       "      <td>243</td>\n",
       "      <td>126</td>\n",
       "      <td>...</td>\n",
       "      <td>0.714</td>\n",
       "      <td>15</td>\n",
       "      <td>36</td>\n",
       "      <td>51</td>\n",
       "      <td>31</td>\n",
       "      <td>11</td>\n",
       "      <td>6</td>\n",
       "      <td>17</td>\n",
       "      <td>21</td>\n",
       "      <td>19.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36</th>\n",
       "      <td>22023</td>\n",
       "      <td>1610612738</td>\n",
       "      <td>BOS</td>\n",
       "      <td>Boston Celtics</td>\n",
       "      <td>0022300080</td>\n",
       "      <td>2023-10-27</td>\n",
       "      <td>BOS vs. MIA</td>\n",
       "      <td>W</td>\n",
       "      <td>239</td>\n",
       "      <td>119</td>\n",
       "      <td>...</td>\n",
       "      <td>0.684</td>\n",
       "      <td>16</td>\n",
       "      <td>39</td>\n",
       "      <td>55</td>\n",
       "      <td>20</td>\n",
       "      <td>7</td>\n",
       "      <td>6</td>\n",
       "      <td>15</td>\n",
       "      <td>19</td>\n",
       "      <td>8.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>37</th>\n",
       "      <td>22023</td>\n",
       "      <td>1610612738</td>\n",
       "      <td>BOS</td>\n",
       "      <td>Boston Celtics</td>\n",
       "      <td>0022300065</td>\n",
       "      <td>2023-10-25</td>\n",
       "      <td>BOS @ NYK</td>\n",
       "      <td>W</td>\n",
       "      <td>241</td>\n",
       "      <td>108</td>\n",
       "      <td>...</td>\n",
       "      <td>0.846</td>\n",
       "      <td>7</td>\n",
       "      <td>39</td>\n",
       "      <td>46</td>\n",
       "      <td>18</td>\n",
       "      <td>6</td>\n",
       "      <td>11</td>\n",
       "      <td>13</td>\n",
       "      <td>22</td>\n",
       "      <td>4.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>38 rows × 28 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "   SEASON_ID     TEAM_ID TEAM_ABBREVIATION       TEAM_NAME     GAME_ID  \\\n",
       "0      22023  1610612738               BOS  Boston Celtics  0022300528   \n",
       "1      22023  1610612738               BOS  Boston Celtics  0022300517   \n",
       "2      22023  1610612738               BOS  Boston Celtics  0022300507   \n",
       "3      22023  1610612738               BOS  Boston Celtics  0022300493   \n",
       "4      22023  1610612738               BOS  Boston Celtics  0022300479   \n",
       "5      22023  1610612738               BOS  Boston Celtics  0022300462   \n",
       "6      22023  1610612738               BOS  Boston Celtics  0022300448   \n",
       "7      22023  1610612738               BOS  Boston Celtics  0022300432   \n",
       "8      22023  1610612738               BOS  Boston Celtics  0022300421   \n",
       "9      22023  1610612738               BOS  Boston Celtics  0022300403   \n",
       "10     22023  1610612738               BOS  Boston Celtics  0022300389   \n",
       "11     22023  1610612738               BOS  Boston Celtics  0022300373   \n",
       "12     22023  1610612738               BOS  Boston Celtics  0022300362   \n",
       "13     22023  1610612738               BOS  Boston Celtics  0022300344   \n",
       "14     22023  1610612738               BOS  Boston Celtics  0022300329   \n",
       "15     22023  1610612738               BOS  Boston Celtics  0022300319   \n",
       "16     22023  1610612738               BOS  Boston Celtics  0022300305   \n",
       "17     22023  1610612738               BOS  Boston Celtics  0022301227   \n",
       "18     22023  1610612738               BOS  Boston Celtics  0022301202   \n",
       "19     22023  1610612738               BOS  Boston Celtics  0022300275   \n",
       "20     22023  1610612738               BOS  Boston Celtics  0022300053   \n",
       "21     22023  1610612738               BOS  Boston Celtics  0022300246   \n",
       "22     22023  1610612738               BOS  Boston Celtics  0022300043   \n",
       "23     22023  1610612738               BOS  Boston Celtics  0022300228   \n",
       "24     22023  1610612738               BOS  Boston Celtics  0022300217   \n",
       "25     22023  1610612738               BOS  Boston Celtics  0022300213   \n",
       "26     22023  1610612738               BOS  Boston Celtics  0022300031   \n",
       "27     22023  1610612738               BOS  Boston Celtics  0022300194   \n",
       "28     22023  1610612738               BOS  Boston Celtics  0022300188   \n",
       "29     22023  1610612738               BOS  Boston Celtics  0022300174   \n",
       "30     22023  1610612738               BOS  Boston Celtics  0022300010   \n",
       "31     22023  1610612738               BOS  Boston Celtics  0022300159   \n",
       "32     22023  1610612738               BOS  Boston Celtics  0022300154   \n",
       "33     22023  1610612738               BOS  Boston Celtics  0022300136   \n",
       "34     22023  1610612738               BOS  Boston Celtics  0022300118   \n",
       "35     22023  1610612738               BOS  Boston Celtics  0022300103   \n",
       "36     22023  1610612738               BOS  Boston Celtics  0022300080   \n",
       "37     22023  1610612738               BOS  Boston Celtics  0022300065   \n",
       "\n",
       "     GAME_DATE      MATCHUP WL  MIN  PTS  ...  FT_PCT  OREB  DREB  REB  AST  \\\n",
       "0   2024-01-11    BOS @ MIL  L  241  102  ...   0.833     6    25   31   22   \n",
       "1   2024-01-10  BOS vs. MIN  W  263  127  ...   0.968     7    39   46   21   \n",
       "2   2024-01-08    BOS @ IND  L  240  131  ...   0.690    13    29   42   26   \n",
       "3   2024-01-06    BOS @ IND  W  240  118  ...   0.526    13    43   56   26   \n",
       "4   2024-01-05  BOS vs. UTA  W  240  126  ...   0.861     9    47   56   24   \n",
       "5   2024-01-02    BOS @ OKC  L  241  123  ...   0.828    17    30   47   33   \n",
       "6   2023-12-31    BOS @ SAS  W  240  134  ...   0.773    13    44   57   29   \n",
       "7   2023-12-29  BOS vs. TOR  W  239  120  ...   0.850    13    39   52   29   \n",
       "8   2023-12-28  BOS vs. DET  W  266  128  ...   0.840    11    32   43   25   \n",
       "9   2023-12-25    BOS @ LAL  W  240  126  ...   0.750    11    33   44   31   \n",
       "10  2023-12-23    BOS @ LAC  W  241  145  ...   0.786    15    36   51   33   \n",
       "11  2023-12-20    BOS @ SAC  W  239  144  ...   0.833    14    36   50   35   \n",
       "12  2023-12-19    BOS @ GSW  L  264  126  ...   0.882    18    37   55   28   \n",
       "13  2023-12-17  BOS vs. ORL  W  239  114  ...   0.875    10    45   55   18   \n",
       "14  2023-12-15  BOS vs. ORL  W  240  128  ...   0.700     9    25   34   31   \n",
       "15  2023-12-14  BOS vs. CLE  W  240  116  ...   0.850    13    31   44   22   \n",
       "16  2023-12-12  BOS vs. CLE  W  241  120  ...   1.000    12    33   45   23   \n",
       "17  2023-12-08  BOS vs. NYK  W  240  133  ...   0.857     8    26   34   24   \n",
       "18  2023-12-04    BOS @ IND  L  239  112  ...   0.667    13    43   56   27   \n",
       "19  2023-12-01  BOS vs. PHI  W  239  125  ...   0.861    10    36   46   25   \n",
       "20  2023-11-28  BOS vs. CHI  W  241  124  ...   0.750    11    41   52   36   \n",
       "21  2023-11-26  BOS vs. ATL  W  239  113  ...   0.800    18    40   58   24   \n",
       "22  2023-11-24    BOS @ ORL  L  240   96  ...   0.730     4    27   31   17   \n",
       "23  2023-11-22  BOS vs. MIL  W  240  119  ...   0.824     4    39   43   27   \n",
       "24  2023-11-20    BOS @ CHA  L  264  118  ...   0.643    11    37   48   19   \n",
       "25  2023-11-19    BOS @ MEM  W  241  102  ...   0.800     9    36   45   20   \n",
       "26  2023-11-17    BOS @ TOR  W  240  108  ...   0.889     8    36   44   29   \n",
       "27  2023-11-15    BOS @ PHI  W  239  117  ...   0.789    12    33   45   23   \n",
       "28  2023-11-13  BOS vs. NYK  W  238  114  ...   0.938     8    29   37   27   \n",
       "29  2023-11-11  BOS vs. TOR  W  242  117  ...   0.615     5    41   46   30   \n",
       "30  2023-11-10  BOS vs. BKN  W  241  121  ...   0.714    17    35   52   29   \n",
       "31  2023-11-08    BOS @ PHI  L  241  103  ...   0.842     9    34   43   28   \n",
       "32  2023-11-06    BOS @ MIN  L  265  109  ...   0.765    11    34   45   20   \n",
       "33  2023-11-04    BOS @ BKN  W  240  124  ...   0.852    10    40   50   22   \n",
       "34  2023-11-01  BOS vs. IND  W  239  155  ...   0.964    11    46   57   27   \n",
       "35  2023-10-30    BOS @ WAS  W  243  126  ...   0.714    15    36   51   31   \n",
       "36  2023-10-27  BOS vs. MIA  W  239  119  ...   0.684    16    39   55   20   \n",
       "37  2023-10-25    BOS @ NYK  W  241  108  ...   0.846     7    39   46   18   \n",
       "\n",
       "    STL  BLK  TOV  PF  PLUS_MINUS  \n",
       "0     5    5    6  13       -33.0  \n",
       "1     5    4    8  19         7.0  \n",
       "2     3    8   15  20        -2.0  \n",
       "3     6    6   17  20        17.0  \n",
       "4     9    8   12  23        29.0  \n",
       "5     7   10   14  15        -4.0  \n",
       "6     6    7   10  12        33.0  \n",
       "7     3    6   16  17         2.0  \n",
       "8    10    4   12  15         6.0  \n",
       "9     8    7    8  17        11.0  \n",
       "10    4    5    9  19        37.0  \n",
       "11    6   10    9  17        25.0  \n",
       "12    6    5    8  13        -6.0  \n",
       "13    4   10   14  19        17.0  \n",
       "14   14    7   10  22        17.0  \n",
       "15    7    8   13  15         9.0  \n",
       "16    9    9   13  13         7.0  \n",
       "17    8    5    7  19        10.0  \n",
       "18    5    9   17  19       -10.0  \n",
       "19   10    8   20  18         6.0  \n",
       "20    6    9   16  18        27.0  \n",
       "21    9    3   12  19        10.0  \n",
       "22   10    4   14  18       -17.0  \n",
       "23    3    5   15  15         3.0  \n",
       "24    6    8   13  15        -3.0  \n",
       "25    6   10   17  19         2.0  \n",
       "26    5    4   10  13         3.0  \n",
       "27    7    8    9  15        10.0  \n",
       "28    3    3   11  22        16.0  \n",
       "29    1    4   12  14        23.0  \n",
       "30    5    3    7  13        14.0  \n",
       "31    8    6   12  13        -3.0  \n",
       "32   13    2   16  26        -5.0  \n",
       "33    4    6   11  17        10.0  \n",
       "34    5    2   11  19        51.0  \n",
       "35   11    6   17  21        19.0  \n",
       "36    7    6   15  19         8.0  \n",
       "37    6   11   13  22         4.0  \n",
       "\n",
       "[38 rows x 28 columns]"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "current_season = games.loc[\n",
    "    (games[\"GAME_DATE\"] >= \"2023-10-24\") & (games[\"GAME_DATE\"] <= \"2024-06-20\")\n",
    "]\n",
    "current_season"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "324399d2-d7d5-45ac-b8c3-51d298836510",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "current_season.isnull().values.any()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "57573682-c9e8-49b0-951b-0a09921ce87a",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Elastic Cloud ID:  ········\n",
      "API Key:  ········\n"
     ]
    }
   ],
   "source": [
    "elastic_cloud_id = getpass(\"Elastic Cloud ID: \")\n",
    "elastic_api_key = getpass(\"API Key: \")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "25c1d15c-9cc7-4a42-a525-8a8ef62b47c4",
   "metadata": {},
   "outputs": [],
   "source": [
    "es = Elasticsearch(cloud_id=elastic_cloud_id, api_key=elastic_api_key)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "5d5742bf-a9b2-4363-917d-01f1debf3734",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "ObjectApiResponse({'acknowledged': True, 'shards_acknowledged': True, 'index': 'boston_celtics_current_season'})"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "es.indices.create(index=\"boston_celtics_current_season\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "154c9f25-635f-40b1-98b9-2598a66702e6",
   "metadata": {},
   "outputs": [],
   "source": [
    "timeframe = \"boston_celtics_current_season\"\n",
    "\n",
    "\n",
    "def doc_generator(df, timeframe):\n",
    "    for index, document in df.iterrows():\n",
    "        yield {\n",
    "            \"_index\": timeframe,\n",
    "            \"_id\": f\"{document['GAME_ID']}\",\n",
    "            \"_source\": document.to_dict(),\n",
    "        }"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "06d6ff03-b166-4475-a976-b02b261bcecc",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(38, [])"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "helpers.bulk(es, doc_generator(current_season, timeframe))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "1de256ef-f264-4f5f-817c-a6ec3694361f",
   "metadata": {},
   "outputs": [],
   "source": [
    "search_query = {\"query\": {\"match\": {\"WL\": \"W\"}}}\n",
    "\n",
    "games_won = es.count(index=\"boston_celtics_current_season\", body=search_query)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "90785f66-10aa-41e1-87e7-e90bc6f0c196",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The Celtics won 29 games this season so far.\n"
     ]
    }
   ],
   "source": [
    "print(f\"The Celtics won {games_won['count']} games this season so far.\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "9c255721-551d-4d6a-aefe-a5e62fdd4cd7",
   "metadata": {},
   "outputs": [],
   "source": [
    "streak_query = {\n",
    "    \"size\": 1000,\n",
    "    \"sort\": [{\"GAME_DATE\": {\"order\": \"asc\"}}],\n",
    "    \"_source\": [\"GAME_DATE\", \"WL\"],\n",
    "}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "cfd4dfc9-11d5-4798-8940-f596e4ef87fc",
   "metadata": {},
   "outputs": [],
   "source": [
    "streak_search = es.search(index=\"boston_celtics_current_season\", body=streak_query)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "66b02cff-2334-4ac8-a2c4-1fb616202b27",
   "metadata": {},
   "outputs": [],
   "source": [
    "gs = [hit[\"_source\"] for hit in streak_search[\"hits\"][\"hits\"]]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "d5665358-1233-4939-bde9-6690321cb8bf",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[('W', 6), ('W', 6), ('W', 5), ('W', 5), ('W', 3)]\n"
     ]
    }
   ],
   "source": [
    "streaks = []\n",
    "current_streak = 1\n",
    "for i in range(1, len(gs)):\n",
    "    if gs[i][\"WL\"] == gs[i - 1][\"WL\"]:\n",
    "        current_streak += 1\n",
    "    else:\n",
    "        streaks.append((gs[i - 1][\"WL\"], current_streak))\n",
    "        current_streak = 1\n",
    "\n",
    "\n",
    "streaks.append((gs[-1][\"WL\"], current_streak))\n",
    "top_streaks = sorted(streaks, key=lambda x: x[1], reverse=True)[:5]\n",
    "print(top_streaks)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "f4501c88-381e-4bed-a177-80c8bc412ab6",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
